#!/usr/bin/env python
import sys
import helper
import class_set
from sets import Set

class FriendRecommendationReducer(helper.ReducerHelper):
    def processor(self, key, lst):
        recom_tag = class_set.RecomTag('friend')
        recom_tag.setRelatedId(key)
        user_set = self.distinct(lst)
        for e in user_set:
            for m in user_set:
                if e != m:
                    self.allocator(self.join(e, m), recom_tag)

def main():
    fr = FriendRecommendationReducer()
    fr.reducer()

if __name__ == '__main__':
    main()

